<template>
  <div class="page-nav">
      <h3 class="logo"><router-link to='/'>小U商城后台</router-link></h3>
      <el-menu
      unique-opened
      router
      :collapse="collapse"
      :default-active="$route.path"
      class="el-menu-vertical-demo"
      background-color="#262a32"
      text-color="rgb(204, 204, 204)"
      >
        <el-menu-item index="/home">
            <i class="el-icon-setting"></i>
            <span slot="title">首页</span>
        </el-menu-item>

        <el-submenu v-for="(item,index) in navmenu" :key="index" :index="'top-'+index">
          <template slot="title">
            <i :class="item.icon"></i>
            <span>{{item.title}}</span>
          </template>
          <el-menu-item :index="val.url" v-for="(val,idx) in item.children" :key="idx">
          {{val.title}}
          </el-menu-item>
        </el-submenu>
        
      
    </el-menu>
  </div>
</template>

<script>
import { mapState,mapGetters } from "vuex"
export default {
    data(){
        return{}
    },
    computed:{
      ...mapState(['collapse']),
      ...mapGetters(['navmenu'])

    },
    methods:{}
}

</script>
<style scoped>
.page-nav{
    height: 100vh;
    background-color: #262a32;
    overflow: hidden;
}
.page-nav .el-menu{
    border-right: 0;
}
.page-nav h3{
    line-height: 60px;
    text-align: center;
    font-size: 20px;
    color: #fff;
    background-color: #444;
    white-space: nowrap;
    overflow: hidden;
    font-weight: normal;
    letter-spacing: 3px;
}
.page-nav .el-menu-item.is-active{
  /* background-color: #FB6D49!important; */
  background-color: #409EFF !important;
  color: #fff;
}
.page-nav .el-submenu .el-menu-item{
  padding-left: 55px!important;
}
</style>